﻿@using Projectmanagement.Models
@{
    ViewBag.Title = "Simultaneous";
}
@(Html.Telerik().Grid<_Simultaneous>()
                            .Name("Simultaneous")
    .DataKeys(keys => { keys.Add(item => item.ID); })
    .ToolBar(toolBar => toolBar.Template(
                @<text> 同传-设备表： <a class="t-button t-grid-add" href="/Simultaneous?Simultaneous-mode=insert">
                    新增记录</a>
</text>
                ))
        .DataBinding(dataBinding =>
        {
            dataBinding.Ajax()
            .Select("_SelectIndex", "Simultaneous")
            .Insert("_InsertAjaxEditing", "Simultaneous")
            .Update("_SaveAjaxEditing", "Simultaneous")
            .Delete("_DeleteAjaxEditing", "Simultaneous");
        })
            .Columns(columns =>
            {
                columns.Bound(item => item.CompanyName).Width(100);
                columns.Bound(item => item.ContactName).Width(100);
                columns.Bound(item => item.ContaceMobile).Width(100);
                columns.Bound(item => item.Superior).Width(100);
                columns.Bound(item => item.ContactTitle).Width(100);


                columns.Command(commands =>
                {
                    commands.Edit();
                    commands.Delete();
                }).Title("操作").Width(200);
            }).DetailView(detail => detail.ClientTemplate(
          Html.Telerik().TabStrip()
                    .Name("TabStrip_<#= ID #>")
                    .SelectedIndex(0)
                    .Items(items =>
                    {
                        items.Add().Text("同传老师").HtmlAttributes(new { style = "width:150px;text-align: center" }).Content(
                              Html.Telerik().Grid<_SimultaneousTeacher>().Name("SimultaneousTeacher_<#= ID #>")
                              .DataKeys(keys => { keys.Add(item => item.ID); })
                              .Editable(editing => editing.Mode(GridEditMode.PopUp)).ToolBar(tb => tb.Insert())
                              .DataBinding(dataBinding =>
                              {
                                  dataBinding.Ajax()
                                      .Select("_SelectIndex", "SimultaneousTeacher", new { simultaneousid = "<#= ID #>" })
                                      .Insert("_InsertAjaxEditing", "SimultaneousTeacher", new { simultaneousid = "<#= ID #>" })
                                      .Update("_SaveAjaxEditing", "SimultaneousTeacher", new { simultaneousid = "<#= ID #>" })
                                      .Delete("_DeleteAjaxEditing", "SimultaneousTeacher", new { simultaneousid = "<#= ID #>" });
                              })
                              .Columns(
                                       columns =>
                                       {
                                           columns.Bound(c => c.TeacherName);
                                           columns.Bound(c => c.TeacherDesc);
                                           columns.Bound(c => c.TeacherMeet);
                                           columns.Command(commands =>
                                           {
                                               commands.Edit();
                                               commands.Delete();
                                           }).Title("操作").Width(200);
                                       }
                                       ).Pageable(item => item.Style(GridPagerStyles.Status).PageSize(30).PageOnScroll(true)).Scrollable(s
    => s.Height(400)).Sortable().Filterable().Resizable(resizing => resizing.Columns(true)).ToHtmlString());
                    }
                    ).ToHtmlString()
            ))
            .Resizable(r => r.Columns(true))
            .Editable(editing => editing.Mode(GridEditMode.PopUp))
               .Pageable(item => item.Style(GridPagerStyles.Status).PageSize(50).PageOnScroll(true)).Scrollable(s => s.Height(600)).Scrollable(c => c.Height(600))
    .Resizable(resizing => resizing.Columns(true))
            .Sortable()
            )
